package com.inplaceedit.client.activity.menu;

import com.google.gwt.text.shared.AbstractRenderer;
import com.core.gwt.place.client.PlaceType;
import com.inplaceedit.client.place.ContactDetailsPlace;
import com.inplaceedit.client.place.ContactNewPlace;
import com.inplaceedit.client.place.HomePlace;

public class PlaceTypeRenderer extends AbstractRenderer<PlaceType> {
	private static PlaceTypeRenderer INSTANCE;

	public static PlaceTypeRenderer get() {
		if (INSTANCE == null) {
			INSTANCE = new PlaceTypeRenderer();
		}
		return INSTANCE;
	}

	private PlaceTypeRenderer() {
	}

	@Override
	public String render(final PlaceType object) {
		String result = null;
		if (object == HomePlace.TYPE) {
			result = "Home";
		} else if (object == ContactNewPlace.TYPE) {
			result = "New Contact";
		} else if (object == ContactDetailsPlace.TYPE) {
			result = "Contact Details";
		} else {
			result = object.getPrefix();
		}
		return result;
	}
}
